/*
* 在java中可以在同一个作用域中写两个名称完全相同的函数，这叫做函数的重载，前提是参数要不同
* 参数不同表示，参数的个数或者参数的数据类型
* fn(int a,int b) fn(int a)  fn(3)
* fn1(int a,String b) fn1(String b,int a) fn1(10,"abc")
* fn2(int a,int b) fn2(int c,int d)  fn2(12,33)
* */
class Noddle {
    String bowlType;
    boolean moreMeat;
    int price;

    Noddle() {

    }

    Noddle(String bowlType,boolean moreMeat) {
        //this表示在类的内部指向自己的指针(引用)
        this.moreMeat = moreMeat;
        this.bowlType = bowlType;
    }

    public void show() {
        price = 10;
        String str = "一碗";
        if(moreMeat) {
            str+="加肉的";
            price+=8;
        } else {
            str+="不加肉的";
        }
        if(bowlType.equals("大碗")) {
            price+=2;
        }
        str+=bowlType;
        str+="的羊肉米线做好了,价格是:"+price+"元";
        System.out.println(str);
    }
}

public class TestNoddle {
    public static void main(String[] args) {
//        Noddle n = new Noddle();
//        n.bowlType = "小碗";
//        n.moreMeat = false;
//        n.show();
        Noddle n1 = new Noddle("小碗",true);
        n1.show();

        Noddle n2 = new Noddle();
        n2.bowlType = "大碗";
        n2.moreMeat = false;
        n2.show();
    }
}
